package com.metro.qd.ats;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import java.io.Serializable;
import java.util.Objects;

/**
 * 列车消息的基类
 */
@JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL)
public class BaseTrain implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 消息ID
     */
    public Integer id;
    /**
     * 线路号
     */
    public Integer line;

    /**
     * 列车标示号，全线唯一
     */
    public Integer train;

    /**
     * 列车编组号
     */
    public Integer group;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        BaseTrain baseTrain = (BaseTrain) o;
        return Objects.equals(id, baseTrain.id) &&
                Objects.equals(line, baseTrain.line);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, line);
    }
}
